<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SECRETARIA DE SALUD :: REGISTRO DE INFORMACION</title>
<link href="../Lib/css/estilos.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/form.js"></script>
<script type="text/javascript" src="../Lib/js/prototype.js"></script>
<?php
	import_request_variables("gP");
	$id_user 	= $_SESSION['id_usuario'];
	$id_unidad 	= $_SESSION['idunidad'];		
	$id_sector 	= $_SESSION['idsector'];	
	$id_delegacion = $_SESSION['iddelegacion'];
	$id_entidad = $_SESSION['identidad'];
	$nUnidad	= $_SESSION['nombreUnidad'];	
	$nUsuario	= $_SESSION['nombreUsuario'];		
	$nivel		= $_SESSION['perfil'];			
	
        include('../Lib/php/conex.php');
	$link= conectaSQL("influenza","inf123456","influenza");
	include('../Lib/php/funciones.php');
	include('../Lib/php/fechas.php');
        header("Content-Type: text/html; charset=iso-8859-1");
	include('matrices.php');
	if($lav == 2){
	$tsq = "a.id_principal = $id_principal and c.id_muestras = $id_muestras";}
	if($lav == 3){
	$tsq = "a.id_principal = $id_principal";
					}
	$sql = "select a.*, 
                       b.*,
                       b.id_principal as idr,
                       c.*
                from dat_generales a
                inner join dat_registro b on (a.id_principal = b.id_generales)
                inner join aux_muestras c on (b.id_principal = c.id_principal)
                where $tsq";
                #echo $sql;
	$res = mssql_query($sql,$link);
	$datos = mssql_fetch_array($res);

?>

<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
a:link {
	text-decoration: none;
}
a:visited {
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
a:active {
	text-decoration: none;
}
.Estilo1 {color: #E6E7E9}
-->
</style></head>


<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
        <td height="100%" colspan="3" valign="top"><div align="center"><img src="images/top.jpg" alt="" width="745" height="102" align="baseline" /></div></td>
  </tr>
</table>



<table width="750" border="0" align="center" cellpadding="0" cellspacing="0" class="datos cuadro">
	<tr align="center" class="nombres">
        <td>IMPRESI&Oacute;N DE LAFICHA DE LABORATORIO<br />
        <?php echo printhour(); ?> </td>
    </tr>
</table>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="0" class="datos cuadro">
	<tr align="center" class="nombres">
        <td><?php include("header_generales_laboratorio2.php");?></td>
    </tr>
</table>

  <table width="3" border="0" align="center" cellpadding="3" cellspacing="3" class="datos cuadro2">
</table>
  <table width="750" border="0" align="center" cellpadding="3" cellspacing="3" class="datos cuadro2">
    <tr>
      <td width="592" bgcolor="#F8B145" colspan="4" align="center">LABORATORIO</td>
    </tr>
    <tr bgcolor="#f3f3f3">
      <td colspan="4" bgcolor="#f3f3f3">SE LE TOMO MUESTRA AL PACIENTE?:
        <?php
	 echo catalogo($datos["nTomaMuestra"], 'Cat_Decision', 'upper(cDecision)','id_principal',$link); 
		?></td>
    </tr>
    <?php if($datos["nTomaMuestra"] == 1){ ?>
    <tr bgcolor="#f3f3f3">
      <td bgcolor="#f3f3f3" class="Aviso">FOLIO:
      <?php
	    	$sqlL = "select * from dat_laboratorio where id_generales = $id_principal ";
	$resL = mssql_query($sqlL,$link);
	$datosL = mssql_fetch_array($resL);
	  if($datos["nTomaMuestra"] == 1){
	  
	  
	  
	  $abrirtm = "block";}else{
	  $abrirtm = "none";}
	  ?>        <?php
	 echo $datos["cFolio"]; 
		?></td>
      <td bgcolor="#f3f3f3">LABORATORIO:
      <?php
		
	 echo catalogo($datosL["id_laboratorio"], 'Cat_Laboratorio', 'upper(cLaboratorio)','id_laboratorio',$link);   
		?></td>
      <td bgcolor="#f3f3f3">TIPO DE MUESTRA:
      <?php
		 #echo catalogo($datosL["nTipoMuestra"], 'cat_procedimientos', 'upper(procedimiento)','id_procedimiento',$link);
                 echo catalogo($datos["nTipoMuestra"], 'cat_procedimientos', 'upper(procedimiento)','id_procedimiento',$link);
		?></td>
      <td bgcolor="#f3f3f3">FECHA DE TOMA DE MUESTRA:<?php echo convertdate5($datos["fToma"]); ?></td>
    </tr>
    <?php } ?>
    <?php 
	
		if($nTipoPaciente == 2){
		?>
    <?php }else{?>
    <?php } ?>
  </table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  </td>
</tr>
</table>
<br />
<br /><br />

</body>
</html>
<script language="javascript">
window.print();
</script>